package com.csweimei.rentmanagementtreasure.enterprise.act;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProviders;

import android.os.Bundle;

import com.chad.library.BR;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.base.AppConfig;
import com.csweimei.rentmanagementtreasure.base.AppViewModelFactory;
import com.csweimei.rentmanagementtreasure.databinding.ActivityHomeEnterBinding;
import com.csweimei.rentmanagementtreasure.enterprise.viewModel.HomeEntVM;
import com.csweimei.rentmanagementtreasure.http.entity.BindEntEntity;
import com.csweimei.rentmanagementtreasure.http.entity.CompanyBean;
import com.csweimei.rentmanagementtreasure.weight.BarChatManger;
import com.github.mikephil.charting.charts.BarChart;

import me.goldze.mvvmhabit.base.BaseActivity;

public class HomeEnterActivity extends BaseActivity<ActivityHomeEnterBinding, HomeEntVM> {


    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_home_enter;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }


    CompanyBean.DataDTO bean;

    @Override
    public void initParam() {
        super.initParam();
        bean = (CompanyBean.DataDTO) getIntent().getSerializableExtra(AppConfig.BUNDLE_KEY);
    }

    @Override
    public void initData() {
        super.initData();
        viewModel.setActivity(this);
        viewModel.entity.set(bean);
        viewModel.setBarChat(binding.bar);
    }

    @Override
    public HomeEntVM initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getApplication());
        return ViewModelProviders.of(this,factory).get(HomeEntVM.class);
    }
}